import request from '@/utils/axios';
import { PermissionListResponse, PermissionResponse } from './modules/permissionModule';


export const apiList = {
    permissionList: '/admin/permission/list',
    addPermission: '/admin/permission/add',
    editPermission: '/admin/permission/edit',
    deletePermission: '/admin/permission/delete',
    getPermissionAll: '/admin/permission/all'
};

export const getPermissionList = (params: object): Promise<PermissionListResponse> => {
    return request({
        url: apiList.permissionList,
        method: 'get',
        params: params
    });
};

export const addPermission = (params: object): Promise<PermissionResponse> => {
    return request({
        url: apiList.addPermission,
        method: 'post',
        data: params
    });
};

export const editPermission = (params: object): Promise<PermissionResponse> => {
    return request({
        url: apiList.editPermission,
        method: 'put',
        data: params
    });
};

export const deletePermission = (params: object): Promise<PermissionResponse> => {
    return request({
        url: apiList.deletePermission,
        method: 'delete',
        data: params
    });
};

// export const getRoleAll = (params: object): Promise<RoleAllResponse> => {
//     return request({
//         url: apiList.getRoleAll,
//         method: 'get',
//         params: params
//     });
// };
